unit event;

interface

uses
  Classes, SysUtils, head, Engine, Picfile;

type

  TEventData = record
    Index: integer;
    Hevent: smallint;
    Levent: smallint;
    datalen: integer;
    data: array of byte;
  end;

  TEventList = record
    EventNum: integer;
    EventData: array of TEventData;
  end;

  TEvent = Class
    EventEngine: PEngine;
    EventPic: TPicFile;
    EventList: TEventList;
    constructor Create(AEngine: PEngine);
    destructor Destroy;
    procedure Release;
  end;

  PEvent = ^TEvent;

implementation

constructor TEvent.Create(AEngine: PEngine);
begin
  EventEngine := AEngine;
  EventPic := TPicFile.Create;
end;

destructor TEvent.Destroy;
begin
  Release;
  inherited Destroy;
end;

procedure TEvent.Release;
var
  I1, I2: integer;
begin
  //
  for I1 := 0 to EventList.EventNum - 1 do
  begin
    EventList.EventData[I1].datalen := 0;
    setlength(EventList.EventData[I1].data, 0);
  end;
  EventList.EventNum := 0;
  setlength(EventList.EventData, 0);
  EventPic.Destroy;
end;

end.

